String backed strongly typed IDs#809
Conversation
Summary
Skipped
🎉 No failed tests in this run. Github Test Reporter by CTRF 💚 🔄 This comment has been updated |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v10.0-preview #809 +/- ##
=================================================
+ Coverage 80.07% 81.36% +1.29%
=================================================
Files 231 231
Lines 4356 4648 +292
Branches 344 340 -4
=================================================
+ Hits 3488 3782 +294
+ Misses 784 783 -1
+ Partials 84 83 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces string-backed strongly typed IDs to the DomainModels library, adding two new TypedId formats: RawString and PrefixedString. These complement the existing numeric and GUID-based ID types, allowing developers to use arbitrary string values as typed identifiers with optional length constraints.
Key Changes:
- Added
RawStringandPrefixedStringformats toTypedIdFormatenum (renumbering existing values) - Introduced
MaxValueLengthproperty toTypedIdAttributefor validating string length constraints - Implemented new
IRawStringTypedId<TSelf>interface andRawStringTypedIdConverter<TId>for JSON serialization
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/Domain/LeanCode.DomainModels/Ids/TypedIdAttribute.cs |
Added RawString and PrefixedString enum values; added MaxValueLength property with documentation |
src/Domain/LeanCode.DomainModels/Ids/ITypedId.cs |
Introduced IRawStringTypedId<TSelf> interface for string-backed typed IDs |
src/Domain/LeanCode.DomainModels/Ids/TypedIdConverter.cs |
Added RawStringTypedIdConverter<TId> for JSON serialization of string IDs |
src/Domain/LeanCode.DomainModels.Generators/TypedIdFormat.cs |
Updated enum to match the attribute changes |
src/Domain/LeanCode.DomainModels.Generators/TypedIdData.cs |
Added MaxValueLength property to generator data model |
src/Domain/LeanCode.DomainModels.Generators/TypedIdGenerator.cs |
Updated generator to extract and pass MaxValueLength from attributes |
src/Domain/LeanCode.DomainModels.Generators/IdSource.cs |
Implemented BuildRawString and BuildPrefixedString methods; refactored switch to expression |
test/Domain/LeanCode.DomainModels.Tests/Ids/ValidConstructTests.cs |
Added test cases for new string formats; added MaxValueLength parameter to existing tests |
test/Domain/LeanCode.DomainModels.Tests/Ids/RawStringTests.cs |
Comprehensive test coverage for RawString format including max length validation |
test/Domain/LeanCode.DomainModels.Tests/Ids/PrefixedStringTests.cs |
Comprehensive test coverage for PrefixedString format including prefix validation and max length |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/Domain/LeanCode.DomainModels.Tests/Ids/PrefixedStringTests.cs
Outdated
Show resolved
Hide resolved
…engthTypedId interfaces
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Domain/LeanCode.DomainModels.EF/PropertyBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Domain/LeanCode.DomainModels.EF/PropertyBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Domain/LeanCode.DomainModels.EF/PropertiesConfigurationBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
f9b4726 to
ff35af7
Compare
|
Another flaky test, added a bug |
…and improve validation
Closes CORELIB-196